﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SystemWnioskujacy.Exceptions {
    public class MissingNameException : SyntaxErrorException {
        public static string MESSAGE = "Missing name exception!";

        public MissingNameException() : base(MESSAGE) {
        }

		/// <summary>
		///	Generate message about missing name of entity.
		/// </summary>
		/// <param name="entity">Name of entity.</param>
        public MissingNameException(string entity)
            : base(GenerateMessage(entity))
		{
        }

		/// <summary>
		///	Generate message about incorrect entity, that not exists and contains another exception.
		/// </summary>
		/// <param name="entity">Name of entity.</param>
		/// <param name="inner">Inner exception.</param>
        public MissingNameException(string entity, Exception inner)
            : base(GenerateMessage(entity), inner) {
        }
		
		/// <summary>
		///	Generate message about incorrect entity, that not exists.
		/// </summary>
		/// <param name="entity">Name of entity.</param>
		private static string GenerateMessage(string entity) {
            return string.Format(SyntaxErrorException.MESSAGE + " Missing name of {0}!", entity);
		}
    }

    public class MissingSetOfFactsNameException : MissingNameException {
        public MissingSetOfFactsNameException()
            : base("set of facts") {
        }
    }

    public class MissingRuleNameException : MissingNameException {
        public MissingRuleNameException()
            : base("rule") {
        }
    }
}
